<?php 

require 'framework/Kernel/App.php';

class Hd{


	 public static function run()
	{
		if(!is_dir('app'))
		{
			self::mkdir();
			self::copyFile();
		}
		//5.3版本的写法,实例化一个对象，调用里面的方法
		// $obj = new Framework\Kernel\App;
		// $obj->run();

		//5.4的版本可以这么写
		(new Framework\Kernel\App)->run();
	}


	private static function mkdir()
	{
		$vars = array(

				'app',
				'app/Common/Conf',
				'app/Home',

				'app/Home/Conf',
				'app/Home/Model',
				'app/Home/View/index',
				'app/Home/Controller',

				'public'
			);
		foreach ($vars as $key => $v) {
			is_dir($v)	or mkdir($v,0777,1);
		}
	}

	private static function copyFile()
	{
		copy('framework/Common/IndexController.php','app/Home/Controller/IndexController.php');
		copy('framework/Common/config.php','app/Common/Conf/config.php');
		copy('framework/Common/config.php','app/Home/Conf/config.php');
		copy('framework/Common/index.php','app/Home/View/index/index.php');
		copy('framework/Common/success.php','public/success.php');
		copy('framework/Common/error.php','public/error.php');
	}


}




Hd::run();